//
//  RecommendCell.swift
//  swiftDemo
//
//  Created by Gerry on 2021/12/15.
//

import UIKit

class RecommendCell: UICollectionViewCell {
    
    var hotModel : HotCateModel? {
        didSet {
            imageView.sd_setImage(with: URL.init(string: hotModel?.icon_url ?? ""), completed: nil)
            titleLabel.text = hotModel?.tag_name
        }
    }
    
    let imageView : UIImageView = {
      let imgView = UIImageView()
        imgView.layer.cornerRadius = 10
        imgView.layer.masksToBounds = true
        return imgView
    }()
    
    let titleLabel : UILabel = {
        let lab = UILabel()
        lab.font = UIFont.systemFont(ofSize: 14)
        lab.textColor = kColor_333
        lab.textAlignment = .center
        return lab
    }()
    
    override init(frame: CGRect) {
        super.init(frame: frame)        
        contentView.addSubview(imageView)
        contentView.addSubview(titleLabel)
        
        imageView.snp.makeConstraints { make in
            make.centerX.equalTo(contentView)
            make.top.equalTo(10)
            make.size.equalTo(CGSize.init(width: 50, height: 50))
        }
        
        titleLabel.snp.makeConstraints { make in
            make.left.right.equalTo(contentView)
            make.top.equalTo(imageView.snp.bottom)
            make.bottom.equalTo(contentView)
        }
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    
}
